<style>
    .btn-submit-m{
        box-shadow: none;
        background: #f18d05;
        color: white!important;
        text-shadow: none;
        border: none;
        height: 27.6px;
        font-size: 12px;
        line-height: 27.6px;
        padding: 0px 20.48px;
        margin: 0;
        text-decoration: none;
        text-align: center;
        cursor: pointer;
        width: 100px;
    }
</style>
<div class="search-bar" style="float: none">
    <div class="search-bar-first">
        <select id="productState" name="productState" style="width:200px;height: 27.6px;">
            <option value="">全部国家</option>
            {volist name='state' id='vo'}
            <option value="{$vo.state}" {eq name='vo.state' value='$Think.get.key'}selected{/eq}>{$vo.state}</option>
            {/volist}
        </select>
        <input type="button" id="btn-submit-m" class="btn-submit-m" value="搜索" /> 
        <input type="button" class="btn-submit-m" value="批量删除"  onclick="DelSelectAll()"/>
        <input type="button" class="btn-submit-m" value="批量导出"  onclick="exports()"/>
    </div>
    <div class="product_nil_tip" id="product_nil_tip" style="display: none; top: 58px;"><span class="me_tip">请输入或选择查询条件</span></div>
</div>
<table class="product-tab">
    <thead>
    <td width="18">
        <input type="checkbox" name="checkbox-all" id="checkbox-all" onclick="checkAll()">
    </td>
    <td width="60" style="color: #FF4646;font-weight: bold;">快递单号</td>
    <td width="80">&nbsp;</td>
    <td align="center" width="100">
        <a id="sort-product-group-handle" class="arrows down" href="javascript:void(0);" style="color: #FF4646;font-weight: bold;">国家(目的地)</a>
    </td>
    <td width="80"><a href="#" rel="nofollow"><span id="Span4" style="color: #FF4646;font-weight: bold;">价格</span></a>
    </td>
    <td width="120" style="color: #FF4646;font-weight: bold;">单号类别

    </td>
    <td width="100" style="color: #FF4646;font-weight: bold;">单号来源</td>
    <td width="120" style="text-align: center" style="color: #FF4646;font-weight: bold;">购买时间</td>
    <td width="50"></td>
</thead>
<!--priduct list start-->
<tbody id="product-list">
    {volist name='data.list' id='vo'}
    <tr>
        <td>
            <input type="checkbox" name="checkboxItem" id="productItemCheckBox_{$vo.id}" value="{$vo.id}" class="productItemCheckBox" />
        </td>
        <td class="product-pic-item">
            <div id="ph-handle-1" class="pic" style="width: 52px; height: auto; *font-size: 30px;">
                <a class="picRind" style="display: block;" href="javascript:void(0):">
                    <span class="hico type7 topt" title="快递单号" style="color: #FF4646;font-weight: bold;background: url();text-indent: 0;">
                        <strong>{$vo.courier_num}</strong>
                    </span>
                </a>
            </div>
        </td>
        <td>
            <br/>
        </td>
        <td>
            <p>
                {$vo.state}
            </p>
        </td>
        <td>
            <p class="sku-price">{$vo.price}</p>
        </td>
        <td>
            <p>{$vo.category}</p>
        </td>
        <td>
            {$vo.source}
        </td>
        <td>
            <p>{$vo.add_time|date='Y/m/d H:i:s',###}</p>
        </td>
        <td align="center">
            <a href="javascript:void(0);" onclick="FreeCourierCodeDel('{$vo.id}')">删除</a>
        </td>
    </tr>
    {/volist}
    <!--priduct list end-->
</tbody>
</table>
<div class="pagination clearfix" id="pagination">
    <input type="hidden" name="totalpage" class="totalpage" value="8" />
    <form name="paginationForm" method="post" action="/wsproduct/manageproduct/manageProductList.htm">
        <input class="gotopage-hide" type="hidden" name="page" value="" />
        <input name='_csrf_token_' type='hidden' value='sgly9lvlblr0'>
        <input type="hidden" name="action" value='' />
    </form>
    <div class="page-links clearfix">
        {$data.page}
    </div>
</div>
<script>
    var best = '';
    var OrdersPrice = '';
    var OrdersMMB = '';
    $(function () {
        //创建 msgBox 对象 ("imghref": "/images/") 指定图片路径
        $.msgBox = new MsgBox({"imghref": "/static/images/"});
        //搜索
        $("#btn-submit-m").click(function () {
            var isUsed = $("#productState").val();
            jQuery('#ManageProductListView').showLoading();
            $.get("{:U('MyCourierCodeList')}", {key: isUsed}, function (data) {
                $("#ManageProductListView").html(data); //这里是重点，右侧数据获取后要显示到div中
                jQuery('#ManageProductListView').hideLoading();        //任务执行成功，关闭进度条
            }, "text");
        });
    })

    function GetManageProductList(Index) {
        jQuery('#ManageProductListView').showLoading();
        var obj = {p: Index};
        var productState = $("#productState").val();
        if (productState != '') {
            obj.key = productState;
        }
        $.get("{:U('MyCourierCodeList')}", obj, function (data) {
            $("#ManageProductListView").html(data); //这里是重点，右侧数据获取后要显示到div中
            jQuery('#ManageProductListView').hideLoading();        //任务执行成功，关闭进度条
        }, "text"
                );
    }

    //删除单号
    function FreeCourierCodeDel(CourierCodeId) {
        index = layer.confirm('确定删除此单号吗？', function (index) {
            jQuery('#ManageProductListView').showLoading();
            $.ajax({
                url: "{:U('CourierCode/FreeCourierCodeDel')}",
                type: "post",
                dataType: "json",
                data: {
                    CourierCodeId: CourierCodeId,
                },
                success: function (data) {
                    if (data.status == 1) {
                        layer.msg(data.info, 1, 1);
                    } else {
                        layer.msg(data.info, 3, 8);
                    }

                    //重新加载数据
                    GetManageProductList('1');
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg("出错啦!请重试", 3, 8);
                }
            })
            jQuery('#ManageProductListView').hideLoading();        //任务执行成功，关闭进度条
            layer.close(index)
        })
    }


    //全选/全清
    function checkAll() {
        var isChecked = $("#checkbox-all").attr("checked");

        if (isChecked) {

            $("input[name='checkboxItem']").attr("checked", true);

        } else {

            $("input[name='checkboxItem']").attr("checked", false);
        }

    }
    function DelSelectAll() {
        layer.confirm('确定删除已选中的单号吗? ', function (index) {
            var checkedlist = "";
            $("input[name='checkboxItem']:checked").each(function () {
                checkedlist = checkedlist + $(this).val().replace("SMT", "") + ",";

            })
            if (checkedlist != "") {
                checkedlist = checkedlist.substring(0, checkedlist.length - 1)
            }
            if (checkedlist == '') {
                layer.msg("请选择要删除的单号!", 3, 8);
                return;
            }
            $.ajax({
                url: "{:U('CourierCode/FreeCourierCodeDel')}",
                type: "post",
                dataType: "json",
                data: {
                    CourierCodeId: checkedlist,
                },
                success: function (data) {
                    if (data.status == 1) {
                        layer.msg(data.info, 1, 1);
                    } else {
                        layer.msg(data.info, 3, 8);
                    }
                    //重新加载数据
                    GetManageProductList('1')
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg("出错啦!请重试", 3, 8);
                }
            })
            layer.close(index);
        })
    }
    function exports() {
        window.open("{:U('CourierCode/export')}");
    }
</script>




